<template>
  <div id="cornerComment" v-if="dialogVisible">
    <div class="cornerComment-in">
      <div class="cornerComment-in-title">
        <span>{{studentId.name}}-失约记录</span>
        <span class="el-icon-circle-close close-Btn-line" @click="closePOpup"></span>
      </div>
      <div class="commentBody">
        <!--本体列表，数据 -->
        <div class="table-body">
          <div class="table-body-box">
            <el-table
                ref="multipleTable"
                :data="arryList"
                :border="tableoption.tableBorder"
                tooltip-effect="dark">
              <el-table-column
                  label="失约时间"
                  align="center"
                  prop="use_time">
              </el-table-column>
              <el-table-column
                  label="失约区角"
                  align="center"
                  prop="use_time">
                <template slot-scope="scope">
                  {{ scope.row.corner.name }}
                </template>
              </el-table-column>
              <el-table-column
                  label="架构人"
                  align="center"
                  prop="use_time">
                <template slot-scope="scope">
                  {{ scope.row.user.realname }}
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
        <!--工具条 分页-->
        <el-col :span="24" class="toolbarLine">
          <el-pagination
              background
              :page-size="page.pagesize"
              :current-page="page.pageindex"
              layout="total, prev, pager, next"
              :total="page.total"
              @current-change="handleSizeChange"></el-pagination>
        </el-col>
      </div>
      <div class="cornerComment-in-footer">
        <el-button type="primary" @click="closePOpup" size="small">确定</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import {pagination, tableoption} from '@/utils/util.js'

export default {
  props: ['visible', 'studentId'], // commoent 学生点评 collection 学生采集
  data() {
    return {
      dialogVisible: false,
      arearBox: '',
      tableoption: tableoption,
      editId: this.$route.query,
      page: {
        pageindex: pagination.pageIndex,
        pagesize: pagination.pageSize,
        total: pagination.total
      },
      arryList: [],
      value1: '',
      navList: [],
      passTime: 0, // 合格时间
      joinTime: 0 // 参与时间
    }
  },
  watch: {
    visible() {
      this.dialogVisible = this.visible
      if (this.visible) {
        this.InitFn()
      }else{
        this.arryList = []
      }
    }
  },
  created() {
  },
  methods: {
    // 初始化
    async InitFn() {
      console.log('页面请求的数据内容：', this.studentId)
      let option = {
        p: this.page.pageindex,
        student_id: this.studentId.id,
        corner_id: '',
        is_apply: 2
      };
      let data = await this.$post(this.api.admin_corner_apply_student, option);
      console.log('data:', data)
      this.arryList = data.list.data
      this.page.total = data.list.total
    },
    handleEdit(index) {
      this.$router.push('/CornerApplyHestoryDetail?id=' + this.arryList[index].id)
    },
    goBack() {
      this.$router.go(-1)
    },
    // 分页
    handleSizeChange(val) {
      this.page.pageindex = val
      this.InitFn()
    },
    showClassList(indexList, index) {
      this.$router.push('/CornerApplyHestoryDetail?corner_id=' + this.arryList[indexList].corner_id + '&class_id=' + this.arryList[indexList].apply_class[index].id)
    },
    addActive(index) {
      this.$router.push('/statudentAtive?id=' + this.arryList[index].id)
    },
    // 关闭弹窗
    closePOpup() {
      this.$emit('update:visible', false)
    }
  },
  mounted() {
  }
}
</script>
<style scoped>
#cornerComment {
  height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
}

.cornerComment-in {
  width: 50%;
  height: 70%;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-radius: 5px;
}

.cornerComment-in-title {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
  font-size: 24px;
}

.cornerComment-in-title span {
  padding: 0 10px;
}

.cornerComment-in-title span:first-child {
  flex: 1;
  font-size: 16px;
}

.cornerComment-in-footer {
  height: 50px;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: center;
}

.commentBody {
  padding: 20px 10px;
  flex: 1;
  overflow-y: auto;
}

.close-Btn-line {
  cursor: pointer;
}

.toolbarLine {
  text-align: center;
}
</style>


